home *** CD-ROM | disk | FTP | other *** search
- { Set 16/256 Colors Palette /TSR }
- {$M 1024,0,0} {$F+}
-
- uses Dos,Txt;
-
- var OldInt9:procedure;
- OldSS,OldSP,MySS,MySP,L:integer;
- Pal17:array[0..16] of byte;
- Pal256:array[0..767] of byte;
-
- { ─────────────── SetPal ─────────────── }
- procedure SetPal;
- begin
- if Mem[0:$182] in [1,2] then Write(#7);
- case Mem[0:$182] of
- 1:SetPalette17(Mem[MemW[0:$184]:MemW[0:$186]]);
- 2:SetPalette(0,256,Mem[MemW[0:$188]:MemW[0:$18A]]);
- end;
- end;
- { ─────────────── MyInt9 ─────────────── }
- procedure MyInt9; interrupt;
- const Flag:byte=0;
- begin
- asm pushf end; OldInt9;
- if Flag=0 then if Mem[0:$417]=3 then begin
- Flag:=1;
- OldSS:=SSeg; OldSP:=SPtr;
- asm cli; mov ss,MySS; mov sp,MySP; sti end;
- SetPal;
- asm cli; mov ss,OldSS; mov sp,OldSP; sti end;
- Flag:=0;
- end;
- end;
-
- begin
- Writeln('Set 16/256 Colors Palette V1.0');
- Writeln('Copyright (C) 1994 by Jou-Nan Chen');
- if ParamCount<>1 then begin Writeln('Usage: SetPal Filename'); Halt; end;
- L:=FileLen(ParamStr(1),1);
- if L<0 then begin Writeln('No such file !'); Halt; end;
- if MemW[0:$180]<>1002 then begin
- MemW[0:$184]:=Seg(Pal17); MemW[0:$186]:=Ofs(Pal17);
- MemW[0:$188]:=Seg(Pal256); MemW[0:$18A]:=Ofs(Pal256);
- if L=17 then begin Mem[0:$182]:=1; FileRead(ParamStr(1),0,L,1,Pal17); end;
- if L=768 then begin Mem[0:$182]:=2; FileRead(ParamStr(1),0,L,1,Pal256); end;
- Writeln('Press [L-Shift]+[R-Shift] to act !');
- MemW[0:$180]:=1002;
- GetIntVec(9,@OldInt9); SetIntVec(9,@MyInt9);
- MySS:=SSeg; MySP:=SPtr;
- Keep(ExitCode);
- end else begin
- if L=17 then begin Mem[0:$182]:=1;
- FileRead(ParamStr(1),0,L,1,Mem[MemW[0:$184]:MemW[0:$186]]); end;
- if L=768 then begin Mem[0:$182]:=2;
- FileRead(ParamStr(1),0,L,1,Mem[MemW[0:$188]:MemW[0:$18A]]); end;
- Writeln('Palette updates !');
- end;
- end.
-